package com.ay.wiki_plt.mapper;

import com.ay.wiki_plt.domain.Category;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface CategoryMapper {

    /*查询全部分类*/
    List<Category> list(String name);

    /*根据id查询分类*/
    @Select("select * from category where id = #{id}")
    Category getByIdCategory(Integer id);

    /*保存分类*/
    @Insert("insert into category(id,parent, name, sort) " +
            "VALUES (#{id},#{parent},#{name},#{sort})")
    void saveCategory(Category category);

    /*修改分类信息*/
    void updateCategory(Category category);

    /*删除分类*/
    void deleteByCategoryList(List<Long> ids);

    /*查询全部分类*/
    @Select("select * from category")
    List<Category> getCategoryList();
}
